package grafica.ventanas;

import grafica.controladores.ControladorNuevoDuenio;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class VentanaNuevoDuenio extends Ventana{

	private JFrame frmNuevoDueo;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTextField textField_3;
	private ControladorNuevoDuenio cont = null; 

	/**
	 * Launch the application.
	 */
/*	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					VentanaNuevoDuenio window = new VentanaNuevoDuenio();
					window.frmNuevoDueo.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}*/

	/**
	 * Create the application.
	 */
	public VentanaNuevoDuenio() {
		initialize();
		cont = new ControladorNuevoDuenio(this);
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frmNuevoDueo = new JFrame();
		frmNuevoDueo.setTitle("Nuevo Due\u00F1o");
		frmNuevoDueo.setBounds(100, 100, 250, 254);
		frmNuevoDueo.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		frmNuevoDueo.getContentPane().setLayout(null);
		
		textField_1 = new JTextField();
		textField_1.setBounds(84, 48, 86, 20);
		frmNuevoDueo.getContentPane().add(textField_1);
		textField_1.setColumns(10);
		
		textField_2 = new JTextField();
		textField_2.setBounds(84, 82, 86, 20);
		frmNuevoDueo.getContentPane().add(textField_2);
		textField_2.setColumns(10);
		
		textField_3 = new JTextField();
		textField_3.setBounds(84, 113, 86, 20);
		frmNuevoDueo.getContentPane().add(textField_3);
		textField_3.setColumns(10);
		
		JLabel lblCdula = new JLabel("C\u00E9dula");
		lblCdula.setBounds(28, 51, 46, 14);
		frmNuevoDueo.getContentPane().add(lblCdula);
		
		JLabel lblNombre = new JLabel("Nombre");
		lblNombre.setBounds(28, 85, 46, 14);
		frmNuevoDueo.getContentPane().add(lblNombre);
		
		JLabel lblApellido = new JLabel("Apellido");
		lblApellido.setBounds(28, 116, 46, 14);
		frmNuevoDueo.getContentPane().add(lblApellido);
		
		JButton btnAgregar = new JButton("Agregar");
		btnAgregar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				cont.NuevoDuenio();
			}
		});
		btnAgregar.setBounds(68, 166, 89, 23);
		frmNuevoDueo.getContentPane().add(btnAgregar);
	}
	
	public void setVisible (boolean visible) 
	{
		this.frmNuevoDueo.setVisible(visible);
	}
	
	public void cerrarVentana()
	{
		frmNuevoDueo.dispose();
	}
	
	public String getCedula(){
		return textField_1.getText();
	}
	
	public String getNombre(){
		return textField_2.getText();
	}
	
	public String getApellido(){
		return textField_3.getText();
	}
}
